package com.cf.base.comm.base;

import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;

import androidx.annotation.NonNull;

import com.cf.base.comm.module.IBaseApplication;
import com.cf.base.comm.module.ModuleApplicationManager;

/**
 * @author yangji
 */
public class BaseApplication extends Application {

    private IBaseApplication moduleApplication = new ModuleApplicationManager();

    @Override
    public void onCreate() {
        super.onCreate();
        moduleApplication.attachBaseContext(this.getBaseContext());
        moduleApplication.onCreate();
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        moduleApplication.attachBaseContext(base);
    }

    @Override
    public void onConfigurationChanged(@NonNull Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        moduleApplication.onConfigurationChanged(newConfig);
    }

}
